package com.corn.turorial.spring.servlet;

import lombok.extern.slf4j.Slf4j;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 * @author : Jim Wu
 * @version 1.0
 * @function :
 * @since : 2021/2/8 10:13
 */
@Slf4j
//@WebFilter(urlPatterns = "/my/*")
public class MyCustomerFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        log.info("自定义filter 的 init方法");
    }

    @Override
    public void destroy() {
        log.info(" filter 销毁 ");
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
        log.info("进入 filter 内部");
        filterChain.doFilter(request, response);
    }
}
